{include file="public/header" /}

<body class="bgc hide-top">

    <!--视频-->
    <style>
        .videobg {
            width: 100vw;
            height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            background: rgba(0, 0, 0, 1);
            z-index: 999;
        }

        #myvideo {
            width: 100%;
            height: 100%;
            position: fixed;
            top: 0%;
            left: 0;
            z-index: 9999;
        }

        .close {
            position: fixed;
            padding: 10px;
            color: #fff;
            right: 5%;
            top: 3%;
            font-size: 18px;
            z-index: 9999999;
        }
    </style>
    <div class="videobg">
        <a class="close" onclick="closevideo()">关闭</a>
        <video id="myvideo" src="{$sysm.task_video}" autoplay controller webkit-playsinline="true" playsinline="true"
            x5-video-player-type="h5" x5-video-player-fullscreen="true" x-webkit-airplay="allow"
            x5-video-orientation="portraint" loop onclick="playPush();">
        </video>
    </div>

    {include file="public/menu" select="4" /}

</body>
{include file="public/footer"/}

<script>
    var _video = document.getElementById('myvideo');
    _video.loop = false; //禁止循环播放，如果视频video没有设置loop参数，可以不用写
    _video.addEventListener('ended', function () {

        $.post('{:url("index/taskAdd")}', {}, function (data) {
            layer.closeAll();
            //console.log(data);return;
            if (data.code == 1) {
                layer.msg(data.msg, { icon: 1, time: 3000 }, function () {
                    window.location.href = "{:url('user/index')}";
                });
            } else {
                layer.msg(data.msg, { icon: 2, time: 1000 }, function () {
                    location.reload();
                })
            }
        });
    }, false);
    function playPush() {
        if (_video.paused) {
            _video.play();
        } else {
            _video.pause();
        }
    }
    function closevideo() {
        _video.pause();
        layer.msg('确定关闭视频吗？确定奖励不可发放！', {
            time: 5000,
            shade: 0.3,
            btn: ['确认', '取消'],
            yes: function () {
                window.location.href = "{:url('user/index')}"
            },
            end:function () {
                _video.play();
            }
        });
    }
</script>

</html>